package com.lanou.liuqixin.datebasedemo.retrofit;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by dllo on 17/4/27.
 */

public class HttpManger {
    private Retrofit mRetrofit;
    private BearApi mBearApi;
    //静态内部单例
    private static class SingletonHolder{
        private static final  HttpManger INSTANCE =new HttpManger();
    }
    public static HttpManger getInstance(){
        return SingletonHolder.INSTANCE;
    }

    private HttpManger(){
        mRetrofit =new Retrofit.Builder().baseUrl(BearApi.BEAR_URL).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).addConverterFactory(GsonConverterFactory.create()).build();
        mBearApi = mRetrofit.create(BearApi.class);
    }
    public BearApi getBearApi() {
        return mBearApi;
    }
}
